package controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;

/** 
 * Controller to generate the Home Page basics to be rendered by a view. 
 * It extends the convenience class AbstractController that encapsulates most 
 * of the drudgery involved in handling HTTP requests. 
 * @author josef@dr-schneeberger.de
 */
public class SaveFahrt extends AlleFahrten {
	protected ModelAndView handleRequestInternal(
			HttpServletRequest httpServletRequest,
			HttpServletResponse httpServletResponse) throws Exception {
		int bootId;
		try {
			bootId = Integer.parseInt(httpServletRequest.getParameter("id"));
		} catch (NumberFormatException e) {
			bootId = 0;
		}
		int personId1;
		try {
			personId1 = Integer.parseInt(httpServletRequest.getParameter("sitz1"));
		} catch (NumberFormatException e) {
			personId1 = 0;
		}
		int personId2;
		try {
			personId2 = Integer.parseInt(httpServletRequest.getParameter("sitz2"));
		} catch (NumberFormatException e) {
			personId2 = 0;
		}
		int personId3;
		try {
			personId3 = Integer.parseInt(httpServletRequest.getParameter("sitz3"));
		} catch (NumberFormatException e) {
			personId3 = 0;
		}
		int personId4;
		try {
			personId4 = Integer.parseInt(httpServletRequest.getParameter("sitz4"));
		} catch (NumberFormatException e) {
			personId4 = 0;
		}
		int personId5;
		try {
			personId5 = Integer.parseInt(httpServletRequest.getParameter("sitz5"));
		} catch (NumberFormatException e) {
			personId5 = 0;
		}
		int personId6;
		try {
			personId6 = Integer.parseInt(httpServletRequest.getParameter("sitz6"));
		} catch (NumberFormatException e) {
			personId6 = 0;
		}
		int personId7;
		try {
			personId7 = Integer.parseInt(httpServletRequest.getParameter("sitz7"));
		} catch (NumberFormatException e) {
			personId7 = 0;
		}
		int personId8;
		try {
			personId8 = Integer.parseInt(httpServletRequest.getParameter("sitz8"));
		} catch (NumberFormatException e) {
			personId8 = 0;
		}
		int personId9;
		try {
			personId9 = Integer.parseInt(httpServletRequest.getParameter("sitz9"));
		} catch (NumberFormatException e) {
			personId9 = 0;
		}
		getFahrtDao().beginne(bootId, personId1, personId2, personId3, personId4, personId5, personId6, personId7, personId8, personId9);
		super.setBeende(false);
		return super.handleRequestInternal(httpServletRequest, httpServletResponse);
	}

}
